package edu.dayu.responsibility;

import java.util.Objects;

public class GroupLeader implements BudgeHandler {
    private BudgeHandler nextHandler;


    @Override
    public void setNextHandler(BudgeHandler nextHandler) {
        this.nextHandler = nextHandler;
    }

    @Override
    public boolean handle(int amount) {
        Objects.requireNonNull(nextHandler);
        if (amount<1000){
            System.out.println("组长批了");
            return true;
        }
        System.out.println(amount+"超出组长范围");
        return nextHandler.handle(amount);
    }
}
